package com.titanrise.crm.controller.customer;

import com.titanrise.crm.environment.annotation.Autowired;
import com.titanrise.crm.environment.annotation.Controller;
import com.titanrise.crm.environment.annotation.FunctionConfig;
import com.titanrise.crm.environment.menu.MenuContext;
import com.titanrise.crm.environment.menu.action.Action;
import com.titanrise.crm.service.CustomerService;

/**
 * @Description:
 * @Author: pront
 * @Time:2024-11-25 21:10
 */
@Controller(basePath = "/customer")
public class CustomerController {


    @Autowired
    private CustomerService customerService;

    @FunctionConfig(path = "/", key = 1, description = "产品管理", divider = "")
    public Action showAllProducts() {
        return customerService.showAllProducts();
    }

    @FunctionConfig(path = "/", key = 2, description = "个人信息管理", divider = "")
    public Action manageUserInfo(MenuContext menuContext) throws InterruptedException {
        return customerService.manageUserInfo(menuContext);
    }

    @FunctionConfig(path = "/", key = 3, description = "发送信息给销售", divider = "")
    public Action sendMsg2Salesperson(MenuContext menuContext) throws InterruptedException {
        return customerService.sendMsg2Salesperson(menuContext);
    }

    @FunctionConfig(path = "/", key = 4, description = "收件箱", divider = "")
    public Action msgBox(MenuContext menuContext) {
        return customerService.msgBox(menuContext);
    }

    @FunctionConfig(path = "/", key = 5, description = "退出", divider = "")
    public Action exitCustomerPage() {
        return Action.JUMP_TO_MENU("/");
    }

    @FunctionConfig(path = "/product", key = 1, description = "查看详情")
    public Action showProductDetails(MenuContext menuContext) {
        return customerService.findById(menuContext);
    }

    @FunctionConfig(path = "/product", key = 2, description = "购买产品")
    public Action buy(MenuContext menuContext) {
        return customerService.buy(menuContext);
    }

    @FunctionConfig(path = "/product", key = 3, description = "查看成交合同")
    public Action showContract(MenuContext menuContext) {
        return customerService.showContract(menuContext);
    }

    @FunctionConfig(path = "/product", key = 4, description = "查看合同状态")
    public Action showContractStatus(MenuContext menuContext) {
        return customerService.showContractStatus(menuContext);
    }

    @FunctionConfig(path = "/product", key = 5, description = "退出", divider = "")
    public Action exitProductPage() {
        return Action.JUMP_TO_MENU("/customer");
    }

    @FunctionConfig(path = "/user", key = 1, description = "完善个人信息")
    public Action completeInfo(MenuContext menuContext) {
        return customerService.completeInfo(menuContext);
    }

    @FunctionConfig(path = "/user", key = 2, description = "修改账号密码")
    public Action updateUsnaPasw(MenuContext menuContext) {
        return customerService.updateUsnaPasw(menuContext);
    }

    @FunctionConfig(path = "/user", key = 3, description = "注销账户")
    public Action deleteAccount(MenuContext menuContext) {
        return customerService.deleteAccount(menuContext);
    }

    @FunctionConfig(path = "/user", key = 4, description = "退出", divider = "")
    public Action exitInfoPage() {
        return Action.JUMP_TO_MENU("/customer");
    }

    @FunctionConfig(path = "/manageMsgBox", key = 1, description = "阅读信息")
    public Action readMessage(MenuContext menuContext) {
        return customerService.readMessage(menuContext);
    }

    @FunctionConfig(path = "/manageMsgBox", key = 2, description = "删除信息")
    public Action deleteMessage() {
        return customerService.deleteMessage();
    }

    @FunctionConfig(path = "/manageMsgBox", key = 3, description = "退出", divider = "")
    public Action exitMsgBoxPage() {
        return Action.JUMP_TO_MENU("/customer");
    }

}
